package com.cy.model.dingtalk;

import com.cy.BasicModel;

import com.cy.ext.plugin.tablebind.TableBind;
import com.cy.model.Account;

import java.util.Date;

@TableBind(tableName="account_map_dingding",pkName = "id")
public class AccountMapDingding extends BasicModel<AccountMapDingding> {
    public static final AccountMapDingding dao = new AccountMapDingding();
    public static final String SELECT_ALL = "`account_id`,`ding_user_id`,`create_time`";


    public AccountMapDingding findByDingUser(String dingUserId) {
        return findFirst("SELECT * FROM account_map_dingding WHERE ding_user_id = ?", dingUserId);
    }

    public AccountMapDingding findByAccount(Long accountId) {
        return findFirst("SELECT * FROM account_map_dingding WHERE account_id = ?", accountId);
    }

    public AccountMapDingding setAccountId(Long accountId){
        return this.set("account_id",accountId);
    }

    public Long getAccountId(){
        return this.get("account_id");
    }

    public Account getAccount(){
        return Account.dao.findById(getAccountId());
    }
        
    public AccountMapDingding setDingUserId(String dingUserId){
        return this.set("ding_user_id",dingUserId);
    }

    public String getDingUserId(){
        return this.getStr("ding_user_id");
    }
        
    public AccountMapDingding setCreateTime(Date createTime){
        return this.set("create_time",createTime);
    }

    public Date getCreateTime(){
        return this.get("create_time");
    }

}
